package sz.szsmk.citizencard.face;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;


import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import sz.szsmk.citizencard.R;
import sz.szsmk.citizencard.ui.activity.FaceAuthActivity;
import sz.szsmk.citizencard.util.MesageEventBus;

public class StartPageFragment extends FaceFragment {
    private TextView faceName;

//    private TextView mErrorMessageView = null;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_start_page, container, false);
        faceName = (TextView) view.findViewById(R.id.face_name);
//        mErrorMessageView = (TextView)view.findViewById(R.id.txt_error);
        return view;
    }


    @Override
    public void onResume() {
        super.onResume();

        if (getArguments() != null) {
            showErrorMessage(getArguments().getInt(FaceAuthActivity.EXTRA_RESULT_CODE, -1));
        }
    }


    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onMessageEvent(MesageEventBus eventBus) {
        if (eventBus.getFaceName() != null) {

            faceName.setText(eventBus.getFaceName());
        }
    }



    private void showErrorMessage(int resultCode) {
    }
}